#include <stdio.h>
#include <stdio.h>
#include <unistd.h>
#include <pthread.h>
#include <inttypes.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_pthread.h"
#include "user_include.h"


void app_main(void)
{
    //pthread_attr_t uart_attr;
    pthread_t uart_thread;
    // esp_pthread_cfg_t esp_pthread_cfg;
    int res;


    // Use the ESP-IDF API to change the default thread attributes
    // esp_pthread_cfg = esp_pthread_get_default_config();
    // esp_pthread_cfg.stack_size = 32768;
    // esp_pthread_cfg.prio += 2;
    // ESP_ERROR_CHECK( esp_pthread_set_cfg(&esp_pthread_cfg) );

    res = pthread_create(&uart_thread, NULL, (void *)&user_ble_task, NULL);
    assert(res == 0);
    printf("Created thread 0x%"PRIx32" with new default config\n", uart_thread);

    res = pthread_create(&uart_thread, NULL, (void *)&user_gpio_task, NULL);
    assert(res == 0);
    printf("Created thread 0x%"PRIx32" with new default config\n", uart_thread);

    
    res = pthread_create(&uart_thread, NULL, (void *)&user_aht20_task, NULL);
    assert(res == 0);
    printf("Created thread 0x%"PRIx32" with new default config\n", uart_thread);
    

    res = pthread_create(&uart_thread, NULL, (void *)&user_command_task, NULL);
    assert(res == 0);
    printf("Created thread 0x%"PRIx32" with new default config\n", uart_thread);


    res = pthread_create(&uart_thread, NULL, (void *)&user_wifi_task, NULL);
    assert(res == 0);
    printf("Created thread 0x%"PRIx32" with new default config\n", uart_thread);

    res = pthread_create(&uart_thread, NULL, (void *)&user_mqtt_task, NULL);
    assert(res == 0);
    printf("Created thread 0x%"PRIx32" with new default config\n", uart_thread);

    while (1)
    {
        /* code */
        vTaskDelay(100);
    }
    


}
